home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11388 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1010 b 

  1. Path: Belgium.EU.net!news
  2. From: albert@sonytel.be (Albert Dorofiev)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Need help!
  5. Date: 14 Mar 1996 09:13:17 GMT
  6. Organization: EUnet Belgium, Leuven, Belgium
  7. Message-ID: <4i8nvd$e0k@news.Belgium.EU.net>
  8. References: <Do858A.Btr@iquest.net>
  9. NNTP-Posting-Host: iris.sonytel.be
  10. X-Newsreader: knews 0.9.5
  11.  
  12. In article <Do858A.Btr@iquest.net>,
  13.     tjones@walknet.com writes:
  14. :>   Can data structures be passed to classes?  In this overly simple
  15. :>   program below, I can fill a data structure in the desc function
  16. :>   of the reg class, but I can not decrement
  17. :>   to the beginning of the structure, so that I can print it out
  18. :>   within the class function.
  19. :>
  20. :>    /* Here is the problem area*/
  21. :>
  22. :>    for(y=0;y<25;y++) dptr--;
  23. :>       
  24. :>    for(y=0;y<25;y++)
  25. :>    printf("\n%4d %s",y,dptr->name);
  26. :>
  27.  
  28. You do decrement it, but you do not increment it while
  29. printing the results out.
  30.         printf("\n%4d %s",y,(dptr++)->name);
  31. -- 
  32. Albert Dorofeev                    albert@sonytel.be
  33.  
  34.  
  35.